package com.ming.dubbo.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ming.dubbo.bean.UserAddress;
import com.ming.dubbo.service.UserService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class MyController {

    @Reference(interfaceClass = UserService.class,version = "1.0-SNAPSHOT",check = true)
    UserService userService;

    /**
     * 生成订单
     * @param userId
     */
    @RequestMapping("/save/order/{userId}")
    public List saveOrder(@PathVariable("userId") String userId){
        // 生成前-根据用户id查询用户地址信息
        List<UserAddress> userAddressList = userService.getUserAddressList(userId);
        return userAddressList;
    }

}
